﻿using SceneEngine;

namespace SceneEditor
{
    public class AddObjectAction : EditAction
    {
        private BaseObject[] targets;

        public BaseObject[] Targets
        {
            get { return targets; }
        }

        public AddObjectAction(BaseObject target)
        {
            this.targets = new BaseObject[1];
            targets[0] = target;
        }

        public AddObjectAction(BaseObject[] targets)
        {
            this.targets = targets;
        }

        public override void Undo()
        {
            for (int i = 0; i < targets.Length; i++)
            {
                EngineGlobals.Scene.Remove(targets[i].Name);
            }
        }

        public override void Redo()
        {
            for (int i = 0; i < targets.Length; i++)
            {
                EngineGlobals.Scene.Add(targets[i].Name, targets[i]);
            }
        }
    }
}
